package club.janna.trace.service.a.impl;

import club.janna.trace.api.AService;
import club.janna.trace.api.BService;
import club.janna.trace.service.domain.AEntity;
import club.janna.trace.service.a.mapper.AMapper;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author Panbo.Guo
 */
@DubboService
public class AServiceImpl implements AService {

    @Autowired
    private AMapper aMapper;
    @DubboReference
    private BService bService;

    @Override
    public String getValue(Long id) {
        AEntity a = aMapper.selectById(id);
        if(a == null)
            throw new RuntimeException("a not found! id -> " + id);
        return bService.getValue(a.getRefId());
    }
}
